home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 50
/
Volume 50 - JOGO DISK .iso
/
Games
/
magicheaven.swf
/
scripts
/
frame_19
/
DoAction.as
Wrap
Text File
|
2007-10-01
|
74KB
|
2,809 lines
function bibi()
{
bg.santa.gotoAndStop("hit");
}
function func()
{
bg.santa.boss.gotoAndPlay(2);
trace("dadadadadada");
bg.santa.gotoAndStop("hit");
}
function func_2()
{
bb--;
adjust_wudi(_root.game_ui);
if(bb <= 5 && bb >= 0)
{
bg.santa.boss.gotoAndPlay("boss");
trace("ooooooooooooooo");
bg.santa.to_die1();
}
else
{
bb = 0;
}
trace("bb=======" + bb);
}
function adjust_wudi(where)
{
where.wudi.gotoAndStop(bb + 1);
}
function next_game()
{
game_paused = true;
this.attachMovie("next_stage","next_stage",3);
}
function next_round()
{
if(game_time > 0 and game_life > 0)
{
if(game_stage < 5)
{
game_stage++;
}
else
{
game_level++;
game_stage = 1;
}
trace("game_level " + game_level + " " + game_stage);
if(game_level <= 4)
{
_root.gotoAndStop("initial");
}
else
{
win_game();
}
if(game_level <= 4)
{
play_music("music_bg" + game_level,true);
}
}
else
{
lose_game();
}
}
function create_stage()
{
bg.removeMovieClip();
game_ui.removeMovieClip();
var _loc2_ = this.attachMovie("bg","bg",1);
_loc2_.bg.gotoAndStop(game_level);
_loc2_.step.gotoAndStop((game_level - 1) * 5 + game_stage);
mission_end_count = 100;
var _loc3_ = this.attachMovie("Ui_infer","game_ui",2);
gotoAndStop("gaming");
}
function create_monsters(type, x, y)
{
var _loc3_ = this.bg.getNextHighestDepth();
var _loc4_ = this.bg.createEmptyMovieClip("snow_shine" + _loc3_,_loc3_);
_loc4_._x = x;
_loc4_._y = y - 20;
var i = 1;
while(i <= 4)
{
var _loc5_ = _loc4_.attachMovie("snow","snow" + i,i);
_loc5_.gotoAndStop(4);
_loc5_.angle = i * 90 * 0.01745;
_loc5_._x = 30 * Math.sin(_loc5_.angle);
_loc5_._y = 30 * Math.cos(_loc5_.angle);
i++;
}
_loc4_.distance = 30;
_loc4_.onEnterFrame = function()
{
if(!_root.game_paused)
{
this.distance -= 2;
for(i in this)
{
this[i]._rotation += 20;
this[i]._x = this.distance * Math.sin(this[i].angle);
this[i]._y = this.distance * Math.cos(this[i].angle);
}
if(this.distance == 10)
{
var _loc4_ = this._parent.getNextHighestDepth();
var monster_mc = this._parent.attachMovie("monster" + type,"monster_" + type + "_" + _loc4_,_loc4_);
monster_mc._x = this._x;
monster_mc._y = this._y + 20;
monster_mc.swapDepths(this);
monster_mc.stop();
monster_mc.mc.stop();
monster_mc.count = 0;
monster_mc._xscale = 2.5;
monster_mc._yscale = 2.5;
monster_mc.type = type;
var _loc3_ = new Color(monster_mc);
_loc3_.setTransform(shine_Transform2);
if(this.cross_step != undefined)
{
monster_mc.cross_step = this.cross_step;
}
monster_mc.onEnterFrame = function()
{
if(!_root.game_paused)
{
this.count += 2;
monster_mc._xscale = 2.5 * this.count;
monster_mc._yscale = 2.5 * this.count;
if(this.count == 40)
{
var _loc3_ = new Color(this);
_loc3_.setTransform(_root.shine_Transform1);
this.mc.play();
delete this.onEnterFrame;
if(this.typ == "land")
{
land_monsterAI(this);
}
else if(this.typ == "fly")
{
fly_monsterAI(this);
}
else
{
_root["bossAI" + game_level](this);
}
}
}
};
}
else if(this.distance < 0)
{
this._alpha = Math.round((40 + this.distance) / 40 * 100);
if(this.distance == -10)
{
for(i in this)
{
this[i].gotoAndStop(3);
}
}
else if(this.distance == -20)
{
for(i in this)
{
this[i].gotoAndStop(2);
}
}
else if(this.distance == -30)
{
for(i in this)
{
this[i].gotoAndStop(1);
}
}
else if(this.distance == -40)
{
this.removeMovieClip();
}
}
}
};
return _loc4_;
}
function create_big_snow(where, what, small, large)
{
this.bg.hit_snow.removeMovieClip();
var _loc7_ = this.bg.getNextHighestDepth();
var _loc5_ = this.bg.createEmptyMovieClip("hit_snow" + _loc7_,_loc7_);
_loc5_._x = where._x;
_loc5_._y = where._y;
_loc5_.distance = small;
var i = 1;
while(i <= 4)
{
var _loc3_ = _loc5_.attachMovie("snow","snow" + i,i);
_loc3_.gotoAndStop(what);
_loc3_.angle = i * 90 * 0.01745;
_loc3_._x = small * Math.sin(_loc3_.angle);
_loc3_._y = small * Math.cos(_loc3_.angle);
i++;
}
_loc5_.onEnterFrame = function()
{
if(!_root.game_paused)
{
for(i in this)
{
this[i]._rotation += 20;
this[i]._x = this.distance * Math.sin(this[i].angle);
this[i]._y = this.distance * Math.cos(this[i].angle);
}
this._alpha = Math.round((1 - this.distance / large) * 100);
this.distance += 3;
if(this.distance > large)
{
for(i in this)
{
this[i].removeMovieClip();
}
if(this.myMission != undefined)
{
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(--mission_end_count < 0)
{
this.myMission();
this.removeMovieClip();
}
}
};
}
else
{
this.removeMovieClip();
}
}
}
};
return _loc5_;
}
function create_land_snow(where)
{
var _loc1_ = bg.getNextHighestDepth();
var _loc2_ = bg.attachMovie("land_snow","land_snow" + _loc1_,_loc1_);
_loc2_._x = where._x;
_loc2_._y = where._y;
}
function snow_down(where)
{
where.wind_dir = 1;
var _loc4_ = 0;
while(_loc4_ <= 25)
{
var _loc3_ = where.getNextHighestDepth();
var _loc2_ = where.attachMovie("snow","snow" + _loc3_,_loc3_);
_loc2_.speed = random(3) + 3;
_loc2_._x = random(600) - 50;
_loc2_._y = random(400);
_loc2_.gotoAndStop(random(4) + 1);
_loc2_.onEnterFrame = function()
{
this._x += 1;
this._y += this.speed;
this._rotation += this.speed;
if(this._x > 580 or this._y > 420)
{
this.gotoAndStop(random(4) + 1);
this.speed = random(3) + 3;
this._x = random(600) - 50;
this._y = - random(-100);
}
};
_loc4_ = _loc4_ + 1;
}
}
function add_presents(where, typ, num)
{
var _loc5_ = bg.getNextHighestDepth();
var _loc3_ = bg.attachMovie("presents","presents" + _loc5_,_loc5_);
_loc3_.living = true;
_loc3_.typ = typ;
_loc3_._x = Math.round(where._x);
_loc3_._y = Math.round(where._y);
_loc3_.special_array = ["power","range","life","speed","cchest"];
_loc3_.come_out = function()
{
if(typ == "fromChest")
{
this.typ = "presents";
this.gotoAndStop(num);
}
else if(typ == "presents" and random(3))
{
this.gotoAndStop(num);
}
else
{
this.typ = this.special_array[random(5)];
this.gotoAndStop(this.typ);
}
play_sound("present_out");
var xspeed = random(20) - random(20);
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
moveAction(this,xspeed,-11 - random(this._y / 35));
if(this.states == "stand")
{
this.find_player();
if(this.typ == "cchest")
{
this.health = 10;
this.to_die = function()
{
if(this.health > 0)
{
this.gotoAndStop("ochest");
this.health = this.health - 1;
if(this.health > 0)
{
add_presents(this,"fromChest",random(10) + 1);
}
else
{
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
this._alpha -= 5;
if(this._alpha < 5)
{
this.removeMovieClip();
}
}
};
}
}
};
}
}
}
};
};
_loc3_.find_player = function()
{
this.exist_count = 0;
this.find_count = 0;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.exist_count > 80)
{
var _loc3_ = this.exist_count % 2;
if(_loc3_)
{
this._alpha = 50;
}
else
{
this._alpha = 100;
}
if(this.exist_count > 130)
{
this.removeMovieClip();
}
}
if(this.hitTest(bg.santa.g))
{
this._alpha = 100;
if(this.typ == "presents")
{
game_score += Number(this.score);
adjust_score(_root.game_ui);
this.gotoAndStop("score");
play_sound("bonus_sound");
}
else if(this.typ == "power")
{
if(game_power < 2)
{
game_power = 2;
this.gotoAndStop(this.typ + "_out");
play_sound("upgrade");
}
else
{
game_score += Number(this.score);
adjust_score(_root.game_ui);
this.gotoAndStop("score");
play_sound("bonus_sound");
}
}
else if(this.typ == "range")
{
if(game_range < 20)
{
game_range = 20;
this.gotoAndStop(this.typ + "_out");
play_sound("upgrade");
}
else
{
game_score += Number(this.score);
adjust_score(_root.game_ui);
this.gotoAndStop("score");
play_sound("bonus_sound");
}
}
else if(this.typ == "life")
{
if(game_life < 10)
{
game_life++;
adjust_life(_root.game_ui);
this.gotoAndStop(this.typ + "_out");
play_sound("upgrade");
}
else
{
game_score += Number(this.score);
adjust_score(_root.game_ui);
this.gotoAndStop("score");
play_sound("bonus_sound");
}
}
else if(this.typ == "speed")
{
if(game_speed < 6)
{
game_speed = 6;
this.gotoAndStop(this.typ + "_out");
play_sound("upgrade");
}
else
{
game_score += Number(this.score);
adjust_score(_root.game_ui);
this.gotoAndStop("score");
play_sound("bonus_sound");
}
}
else if(this.typ == "cchest")
{
game_score += Number(this.score);
adjust_score(_root.game_ui);
this.gotoAndStop("score");
play_sound("bonus_sound");
}
this._x = bg.santa._x;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
this._y -= 2;
if(++this.find_count == 20)
{
this.removeMovieClip();
}
}
};
}
}
};
};
_loc3_.show_score = function(which)
{
var _loc3_ = 100000 + this.score;
var _loc4_ = this.score.toString().length;
if(which > _loc4_)
{
this["num" + which]._visible = 0;
}
else
{
var _loc5_ = Number(_loc3_.toString().slice(6 - which,7 - which));
this["num" + which].gotoAndStop(_loc5_ + 1);
}
};
_loc3_.come_out();
return _loc3_;
}
function adjust_life(where)
{
if(game_life > 10)
{
where.life.gotoAndStop(10);
}
else if(game_life > 0 and game_life <= 10)
{
where.life.gotoAndStop(game_life);
}
else
{
where.life._visible = 0;
}
}
function adjust_score(where)
{
var _loc1_ = 100000000 + game_score;
var _loc10_ = Number(_loc1_.toString().slice(8,9)) + 1;
var _loc3_ = Number(_loc1_.toString().slice(7,8)) + 1;
var _loc4_ = Number(_loc1_.toString().slice(6,7)) + 1;
var _loc5_ = Number(_loc1_.toString().slice(5,6)) + 1;
var _loc6_ = Number(_loc1_.toString().slice(4,5)) + 1;
var _loc7_ = Number(_loc1_.toString().slice(3,4)) + 1;
var _loc8_ = Number(_loc1_.toString().slice(2,3)) + 1;
var _loc9_ = Number(_loc1_.toString().slice(1,2)) + 1;
where.num1.gotoAndStop(_loc10_);
where.num10.gotoAndStop(_loc3_);
where.num100.gotoAndStop(_loc4_);
where.num1000.gotoAndStop(_loc5_);
where.num10000.gotoAndStop(_loc6_);
where.num100000.gotoAndStop(_loc7_);
where.num1000000.gotoAndStop(_loc8_);
where.num10000000.gotoAndStop(_loc9_);
}
function adjust_boss(where)
{
if(game_stage <= 4)
{
where.boss.swapDepths(1000);
where.boss.removeMovieClip();
}
else
{
var _loc3_ = this["game_boss" + game_level + "_health"];
if(_loc3_ > 0)
{
where.boss.gotoAndStop(this["game_boss" + game_level + "_health"]);
}
else
{
where.boss._visible = 0;
}
}
}
function adjust_time(where)
{
if(game_stage <= 4)
{
game_time = 60;
}
else
{
game_time = 99;
}
where.time10.gotoAndStop(Math.floor(game_time / 10) + 1);
where.time1.gotoAndStop(game_time - Math.floor(game_time / 10) * 10 + 1);
where.time_count = 0;
where.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(monsters_exist > 0)
{
if(++this.time_count == 80)
{
this.time_count = 0;
if(game_time > 0)
{
game_time--;
if(game_time >= 0)
{
this.time10.gotoAndStop(Math.floor(game_time / 10) + 1);
this.time1.gotoAndStop(game_time - Math.floor(game_time / 10) * 10 + 1);
}
if(game_time == 0)
{
create_big_snow(bg.santa,4,8,100);
bg.santa.gotoAndStop("hit");
bg.santa.onEnterFrame = function()
{
if(!_root.game_paused)
{
this._alpha -= 1;
if(this._alpha <= 0)
{
next_game();
delete this.onEnterFrame;
}
}
};
}
}
}
else if(game_time < 10)
{
var _loc4_ = new Color(this.time10);
var _loc3_ = new Color(this.time1);
if(this.time_count % 2 == 0)
{
_loc4_.setTransform(shine_Transform2);
_loc3_.setTransform(shine_Transform2);
}
else
{
_loc4_.setTransform(shine_Transform1);
_loc3_.setTransform(shine_Transform1);
}
}
}
}
};
}
function win_game()
{
bg.removeMovieClip();
game_ui.removeMovieClip();
play_music("music_win",true);
gotoAndStop("win");
}
function lose_game()
{
bg.removeMovieClip();
game_ui.removeMovieClip();
play_music("music_lose",false);
music_lose.onSoundComplete = function()
{
play_music("music_op",true);
};
gotoAndStop("lose");
}
function init_control_btns(where)
{
where.play_btn.gotoAndStop(1);
where.play_btn.onPress = function()
{
play_sound("button_sound");
this._y = this._y + 1;
if(monsters_exist > 0)
{
if(game_paused)
{
for(var _loc2_ in bg)
{
if(bg[_loc2_].living)
{
if(bg[_loc2_].attack != undefined)
{
bg[_loc2_].mc.play();
}
}
}
game_paused = false;
this.gotoAndStop(1);
}
else
{
for(_loc2_ in bg)
{
if(bg[_loc2_].living)
{
if(bg[_loc2_].attack != undefined)
{
bg[_loc2_].mc.stop();
}
}
}
game_paused = true;
this.gotoAndStop(2);
}
}
};
where.play_btn.onRelease = where.play_btn.onReleaseOutside = function()
{
this._y = this._y - 1;
};
if(game_music)
{
where.sound_btn.gotoAndStop(1);
}
else
{
where.sound_btn.gotoAndStop(2);
}
where.sound_btn.onPress = function()
{
play_sound("button_sound");
this._y = this._y + 1;
if(game_music)
{
game_music = false;
stopAllSounds();
this.gotoAndStop(2);
}
else
{
game_music = true;
music_resume = true;
play_music(now_music,true);
this.gotoAndStop(1);
}
};
where.sound_btn.onRelease = where.sound_btn.onReleaseOutside = function()
{
this._y = this._y - 1;
};
where.play_btn.enabled = false;
where.sound_btn.enabled = false;
}
function moveAction(who, xspeed, yspeed)
{
if(who.yspeed == undefined)
{
who.yspeed = yspeed;
}
var _loc3_ = false;
if(who.yspeed >= 0)
{
if(who.cross_step > 0)
{
who.cross_step = who.cross_step - 1;
}
else if(who.living)
{
if(bg.step.hitTest(who._x,who._y + 15,true))
{
if(!bg.step.hitTest(who._x,who._y - 15,true))
{
_loc3_ = true;
adjustY(who,bg.step);
}
}
}
else if(bg.step.hitTest(who._x,who._y + 45,true))
{
if(!bg.step.hitTest(who._x,who._y + 15,true))
{
_loc3_ = true;
adjustY(who,bg.step);
}
}
}
if(_loc3_ and who.yspeed >= 0)
{
who.states = "stand";
delete who.yspeed;
}
if(!_loc3_ or who.yspeed < 0)
{
if(who.yspeed < 10)
{
who.yspeed += 0.75;
}
who._y += who.yspeed;
if(who._y > 400 + who._height)
{
who._y = 0;
}
who.states = "jump";
}
who.hit_ground = _loc3_;
var _loc4_ = false;
if(who.attack != undefined)
{
if(who.living)
{
if(bg.step.hitTest(who._x + xspeed,who._y - 15,true))
{
_loc4_ = true;
}
}
else if(bg.step.hitTest(who._x + xspeed,who._y,true))
{
_loc4_ = true;
}
}
if(_loc4_)
{
who.get_blocked();
}
else if(who.states == "stand")
{
if(who._x + xspeed > 20 and who._x + xspeed < 530)
{
who._x += xspeed;
}
}
else if(who._x + xspeed / 2 > 20 and who._x + xspeed / 2 < 530)
{
who._x += xspeed / 2;
}
who.hit_blocks = _loc4_;
if(who.living)
{
var _loc6_ = false;
if(bg.step.hitTest(who._x,who._y - 65,true))
{
if(!bg.step.hitTest(who._x,who._y - 85,true))
{
_loc6_ = true;
}
}
who.can_jump = _loc6_;
var _loc7_ = false;
if(bg.step.hitTest(who._x,who._y + 15,true))
{
if(!bg.step.hitTest(who._x,who._y + 30,true))
{
_loc7_ = true;
}
}
if(who._y < stage_down_max)
{
who.can_down = _loc7_;
}
var _loc5_ = false;
if(!bg.step.hitTest(who._x + xspeed,who._y + 15,true))
{
_loc5_ = true;
}
who.ahead_down = _loc5_;
}
if(who.attack != undefined)
{
if(who.living)
{
if(who.g.hitTest(bg.santa.g))
{
bg.santa.to_die();
}
}
}
}
function adjustY(who, where)
{
if(who.living)
{
var _loc4_ = 0;
}
else
{
_loc4_ = 30;
}
var _loc2_ = 5;
while(_loc2_ >= 1)
{
if(!where.hitTest(who._x,who._y + _loc4_ + _loc2_ - 1,true))
{
who._y += _loc2_;
}
else
{
_loc2_ = _loc2_ - 1;
}
}
var _loc3_ = 5;
while(_loc3_ >= 1)
{
if(where.hitTest(who._x,who._y + _loc4_ - _loc3_,true))
{
who._y -= _loc3_;
}
else
{
_loc3_ = _loc3_ - 1;
}
}
}
function land_monsterAI(who)
{
who.speed = -2;
who.states = "stand";
who.living = true;
who.turn = function()
{
if(this.states == "stand")
{
this.gotoAndStop("turn");
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(this.mc._currentframe == this.mc._totalframes)
{
this._xscale *= -1;
this.move_me();
}
}
};
}
};
who.get_blocked = function()
{
if(this.living)
{
if(random(2))
{
this.jump(1);
}
else
{
this.turn();
}
}
};
who.jump = function(how)
{
this.gotoAndStop("jump");
if(how == -1)
{
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
moveAction(this,0,-12);
if(who.states == "stand")
{
create_land_snow(this);
this.move_me();
}
}
};
}
else if(how == 1)
{
this.cross_step = 5;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
moveAction(this,0,1);
if(who.states == "stand")
{
create_land_snow(this);
this.move_me();
}
}
};
}
};
who.move_me = function()
{
this.gotoAndStop("walk");
if(!this.init)
{
this.init = true;
this._xscale = (1 - random(2) * 2) * 100;
}
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
moveAction(this,this.speed * this._xscale / 100,0);
if(who._x + this.speed * this._xscale / 100 > stage_max)
{
who.turn();
}
else if(who._x + this.speed * this._xscale / 100 < stage_min)
{
who.turn();
}
else if(who.hit_blocks)
{
who.turn();
}
else if(who.ahead_down)
{
if(random(3))
{
who.turn();
}
}
if(who.states == "stand")
{
if(!random(80))
{
if(who.can_jump)
{
who.jump(-1);
}
}
else if(!random(120))
{
if(who.can_down)
{
who.jump(1);
}
}
else if(!random(60))
{
if(this.attack)
{
who.attacking();
}
}
}
}
};
};
who.attacking = function()
{
this.gotoAndStop("attack");
this.action_count = 0;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count > 35)
{
this.move_me();
}
else if(who.mc.weapon.hitTest(bg.santa.g))
{
bg.santa.to_die();
}
}
};
};
who.to_die = function()
{
if(this.living)
{
who.gotoAndStop("hit");
who.freeze_count = 0;
if(who.iceball == undefined)
{
who.attachMovie("iceball","iceball",this.getNextHighestDepth());
who.iceball.gotoAndStop(1);
who.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(this.living)
{
this.freeze_count = this.freeze_count + 1;
if(this.freeze_count == 100)
{
this.freeze_count = 0;
if(this.iceball._currentframe > 1)
{
this.iceball.prevFrame();
this.mc.play();
}
else
{
this.iceball.removeMovieClip();
this.move_me();
}
}
}
}
};
}
else if(game_power == 1)
{
if(who.iceball._currentframe < 5)
{
who.iceball.nextFrame();
}
else
{
who.iceball.gotoAndStop(6);
who.mc.stop();
}
}
else if(game_power == 2)
{
if(who.iceball._currentframe < 4)
{
who.iceball.gotoAndStop(who.iceball._currentframe + 3);
}
else
{
who.iceball.gotoAndStop(6);
who.mc.stop();
}
}
}
};
who.monster_dead = function()
{
monsters_exist--;
var _loc4_ = bg.getNextHighestDepth();
var _loc5_ = bg.attachMovie("hit_dead_snow","hit_dead_snow" + _loc4_,_loc4_);
_loc5_._x = this._x;
_loc5_._y = this._y;
create_big_snow(this,3,10,80)._y = create_big_snow(this,3,10,80)._y - 30;
var _loc3_ = random(this.type + 2) + 1;
if(_loc3_ > 8)
{
_loc3_ = 8;
}
game_score += 100 * this.type;
adjust_score(_root.game_ui);
if(this.living)
{
add_presents(this,"presents",_loc3_);
}
this.removeMovieClip();
};
who.move_me();
}
function fly_monsterAI(who)
{
who.speed = 1;
who.states = "stand";
who.living = true;
who.turn = function()
{
this.gotoAndStop("turn");
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(this.mc._currentframe == this.mc._totalframes)
{
this._xscale *= -1;
this.move_me();
}
}
};
};
who.move_me = function()
{
this.gotoAndStop("walk");
if(!this.init)
{
this.init = true;
this._xscale = (1 - random(2) * 2) * 100;
}
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
this._x += this.speed * (bg.santa._x - this._x) / Math.abs(bg.santa._x - this._x);
this._y += this.speed * (bg.santa._y - this._y) / Math.abs(bg.santa._y - this._y);
if(this._xscale == 100)
{
if(bg.santa._x - this._x > 5)
{
this.turn();
}
}
else if(this._xscale == -100)
{
if(bg.santa._x - this._x < 5)
{
this.turn();
}
}
if(this.g.hitTest(bg.santa.g))
{
bg.santa.to_die();
}
if(!random(60))
{
this.attacking();
}
}
};
};
who.attacking = function()
{
this.gotoAndStop("attack");
this.action_count = 0;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count > 35)
{
this.move_me();
}
else if(who.mc.weapon.hitTest(bg.santa.g))
{
bg.santa.to_die();
}
}
};
};
who.to_die = function()
{
if(this.living)
{
who.gotoAndStop("hit");
who.freeze_count = 0;
if(who.iceball == undefined)
{
who.attachMovie("iceball","iceball",this.getNextHighestDepth());
who.iceball.gotoAndStop(1);
who.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(this.living)
{
this.freeze_count = this.freeze_count + 1;
if(this.freeze_count == 100)
{
this.freeze_count = 0;
if(this.iceball._currentframe > 1)
{
this.iceball.prevFrame();
this.mc.play();
}
else
{
this.iceball.removeMovieClip();
this.move_me();
}
}
}
}
};
}
else if(game_power == 1)
{
if(who.iceball._currentframe < 5)
{
who.iceball.nextFrame();
}
else
{
who.iceball.gotoAndStop(6);
who.mc.stop();
}
}
else if(game_power == 2)
{
if(who.iceball._currentframe < 4)
{
who.iceball.gotoAndStop(who.iceball._currentframe + 3);
}
else
{
who.iceball.gotoAndStop(6);
who.mc.stop();
}
}
}
};
who.monster_dead = function()
{
monsters_exist--;
var _loc4_ = bg.getNextHighestDepth();
var _loc5_ = bg.attachMovie("hit_dead_snow","hit_dead_snow" + _loc4_,_loc4_);
_loc5_._x = this._x;
_loc5_._y = this._y;
create_big_snow(this,3,10,80)._y = create_big_snow(this,3,10,80)._y - 30;
var _loc3_ = random(this.type + 2) + 1;
if(_loc3_ > 8)
{
_loc3_ = 8;
}
game_score += 100 * this.type;
adjust_score(_root.game_ui);
if(this.living)
{
add_presents(this,"presents",_loc3_);
}
this.removeMovieClip();
};
who.move_me();
}
function create_player()
{
var _loc7_ = bg.getNextHighestDepth();
var _loc5_ = bg.attachMovie("santa","santa",_loc7_);
_loc5_._x = 75;
_loc5_._y = 375;
_loc5_.speed_rate = 0;
_loc5_.living = true;
_loc5_.unbreak = false;
_loc5_.attack = true;
_loc5_.to_die = function()
{
if(!this.unbreak)
{
game_life--;
adjust_life(_root.game_ui);
game_power = org_game_power;
game_range = org_game_range;
game_speed = org_game_speed;
play_sound("santa_hit" + random(2));
this.gotoAndStop("hit");
unbreakAction(this);
this.die_count = 0;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.die_count >= 20)
{
this.die_count = 0;
if(game_life > 0)
{
this.gotoAndStop("stand");
this.doing = false;
this.gaming();
}
else
{
create_big_snow(this,4,8,100);
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
this._alpha -= 3;
if(this._alpha <= 0)
{
next_game();
delete this.onEnterFrame;
}
}
};
}
}
}
};
}
};
_loc5_.to_die1 = function()
{
if(!this.unbreak)
{
adjust_life(_root.game_ui);
game_power = org_game_power;
game_range = org_game_range;
game_speed = org_game_speed;
play_sound("santa_hit" + random(2));
this.gotoAndStop("hit");
unbreakAction(this);
this.die_count = 0;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.die_count >= 20)
{
this.die_count = 0;
if(game_life > 0)
{
this.gotoAndStop("stand");
this.doing = false;
this.gaming();
}
else
{
create_big_snow(this,4,8,100);
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
this._alpha -= 3;
if(this._alpha <= 0)
{
next_game();
delete this.onEnterFrame;
}
}
};
}
}
}
};
}
};
_loc5_.gaming = function()
{
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
gameControl(this);
}
};
};
_loc5_.gaming();
var _loc4_ = bg.step.Ma;
var _loc6_ = _loc4_.length;
monsters_exist = _loc6_;
monster_all = monsters_exist;
var _loc3_ = 0;
while(_loc3_ < _loc6_)
{
create_monsters(_loc4_[_loc3_][0],_loc4_[_loc3_][1],_loc4_[_loc3_][2]);
_loc3_ = _loc3_ + 1;
}
_loc7_ = bg.getNextHighestDepth();
var _loc8_ = bg.attachMovie("show_levels","show_levels",_loc7_);
_loc8_.stop();
_loc8_.onEnterFrame = function()
{
if(next_stage == undefined)
{
this.play();
delete this.onEnterFrame;
}
};
}
function unbreakAction(who)
{
who.unbreak = true;
if(game_life > 0)
{
var _loc4_ = who.createEmptyMovieClip("unbreakMC",who.getNextHighestDepth());
_loc4_.unbreak_start = 0;
_loc4_.onEnterFrame = function()
{
if(!_root.game_paused)
{
this.unbreak_start = this.unbreak_start + 1;
var _loc3_ = this.unbreak_start % 10;
if(_loc3_ < 5)
{
this._parent._alpha = 60;
}
else
{
this._parent._alpha = 100;
}
if(this.unbreak_start > 150)
{
this._parent._alpha = 100;
this._parent.unbreak = false;
this.removeMovieClip();
}
}
};
}
}
function gameControl(who)
{
if(!who.get_hit)
{
if(Key.isDown(Acode))
{
key_AD_Action(who,-1);
}
else if(Key.isDown(Dcode))
{
key_AD_Action(who,1);
}
else
{
normalAction_AD(who);
}
if(Key.isDown(Jcode))
{
if(!Jcode_pressed)
{
Jcode_pressed = true;
key_J_Action(who);
}
}
else
{
Jcode_pressed = false;
}
if(Key.isDown(Wcode))
{
if(!Wcode_pressed)
{
Wcode_pressed = true;
key_W_Action(who);
}
}
else
{
Wcode_pressed = false;
if(Key.isDown(Scode))
{
if(!Scode_pressed)
{
Scode_pressed = true;
key_S_Action(who);
}
}
else
{
Scode_pressed = false;
}
}
}
playerMove(who,game_speed * who.speed_rate,0);
}
function playerMove(who, xspeed, yspeed)
{
if(who.yspeed == undefined)
{
who.yspeed = yspeed;
}
var _loc3_ = false;
if(who.yspeed >= 0)
{
if(who.cross_step > 0)
{
who.cross_step = who.cross_step - 1;
}
else if(bg.step.hitTest(who._x,who._y + 15,true))
{
if(!bg.step.hitTest(who._x,who._y - 15,true))
{
_loc3_ = true;
adjustY(who,bg.step);
}
}
}
if(_loc3_ and who.yspeed >= 0)
{
who.states = "stand";
delete who.yspeed;
}
if(!_loc3_ or who.yspeed < 0)
{
who.states = "jump";
if(who.yspeed < 10)
{
who.yspeed += 0.75;
}
who._y += who.yspeed;
if(who._y > 400 + who._height)
{
who._y = 0;
}
}
var _loc4_ = false;
if(bg.step.hitTest(who._x + xspeed * 2,who._y,true))
{
if(bg.step.hitTest(who._x + xspeed,who._y - 30,true))
{
_loc4_ = true;
}
}
if(!_loc4_)
{
if(who._x + xspeed > 10 and who._x + xspeed < 540)
{
who._x += xspeed;
}
}
}
function key_W_Action(who)
{
if(who.states == "stand")
{
if(who._currentframe != 25)
{
who.doing = true;
who.yspeed = -11;
who.gotoAndStop("jump");
play_sound("jump");
}
}
}
function key_S_Action(who)
{
if(who._y < stage_down_max)
{
if(who.states == "stand")
{
if(who._currentframe != 25)
{
who.doing = true;
who.cross_step = 5;
who.yspeed = 1;
who.gotoAndStop("jump");
play_sound("jump");
}
}
}
}
function key_AD_Action(who, dir)
{
who._xscale = dir * 100;
who.speed_rate = dir;
if(!who.doing)
{
if(who.states == "stand")
{
if(who._currentframe != 9)
{
who.gotoAndStop("move");
}
}
else if(who.states == "jump")
{
if(who._currentframe != 25)
{
who.gotoAndStop("jump");
}
}
}
}
function normalAction_AD(who)
{
who.speed_rate = 0;
if(!who.doing)
{
if(who.states == "stand")
{
if(who._currentframe != 1)
{
create_land_snow(who,2);
who.gotoAndStop("stand");
}
}
else if(who.states == "jump")
{
if(who._currentframe != 25)
{
who.gotoAndStop("jump");
}
}
}
}
function key_J_Action(who)
{
var _loc2_ = false;
for(var _loc3_ in bg)
{
if(bg[_loc3_].living)
{
if(bg[_loc3_].iceball._currentframe == 6)
{
if(bg[_loc3_].iceball.hitTest(who.g))
{
who.doing = true;
who.gotoAndStop("kick");
play_sound("santa_kick");
create_big_snow(who,2,8,80);
rollAction(bg[_loc3_],who._xscale / 100);
_loc2_ = true;
break;
}
}
}
}
if(!_loc2_)
{
if(who._currentframe != 17)
{
who.doing = true;
who.gotoAndStop("shoot");
}
else if(who.ready)
{
who.mc.gotoAndPlay(2);
}
}
}
function shootAction(where, point)
{
play_sound("shoot_sound");
var _loc4_ = bg.getNextHighestDepth();
var _loc3_ = bg.attachMovie("shoot","shoot",_loc4_);
_loc3_._xscale = where._xscale;
_loc3_._x = get_map_point(point)[0];
_loc3_._y = get_map_point(point)[1];
if(game_power > 1)
{
_loc3_._xscale *= 1.5;
_loc3_._yscale *= 1.5;
}
_loc3_.shoot_count = 0;
_loc3_.xspeed = game_range;
_loc3_.yspeed = 0;
_loc3_.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(this.can_go)
{
if(this._x < 0 or this._x > 550)
{
this.removeMovieClip();
}
else if(++this.shoot_count > 7)
{
if(this.shined)
{
this.play();
}
else
{
this.shined = true;
var _loc4_ = new Color(this);
_loc4_.setTransform(shine_Transform2);
}
}
else
{
this.yspeed += 0.75;
this._x += this.xspeed * this._xscale / 100;
this._y += this.yspeed;
this._rotation += this._xscale / 20;
for(var _loc3_ in bg)
{
if(bg[_loc3_].g.hitTest(this._x,this._y,true))
{
if(bg[_loc3_]._name != "santa")
{
bg[_loc3_].to_die();
create_big_snow(this,1,8,40);
this.removeMovieClip();
break;
}
}
}
}
}
}
};
}
function rollAction(who, dir)
{
if(who.living)
{
who.living = false;
who.mc.stop();
who.dir = dir;
who.speed = 12;
who.mc._y += 30;
who.iceball._y += 30;
who._y -= 30;
who.hit_count = 0;
who.kill_count = 0;
who.explode = function()
{
this.mc._visible = 0;
this.iceball.play();
var _loc5_ = create_big_snow(this,4,10,80);
if(monsters_exist <= 1)
{
_loc5_.myMission = function()
{
next_game();
};
}
delete this.onEnterFrame;
if(game_stage <= 4)
{
add_presents(this,"presents",8 + this.kill_count);
if(this.kill_count >= monster_all - 1)
{
var _loc4_ = bg.attachMovie("presents","level_presents",bg.getNextHighestDepth());
_loc4_._x = 275;
_loc4_._y = -10;
_loc4_.gotoAndStop("cbox");
_loc4_.yspeed = 3;
_loc4_.find_count = 0;
_loc4_.show_score = function(which)
{
var _loc3_ = 100000 + this.score;
var _loc4_ = this.score.toString().length;
if(which > _loc4_)
{
this["num" + which]._visible = 0;
}
else
{
var _loc5_ = Number(_loc3_.toString().slice(6 - which,7 - which));
this["num" + which].gotoAndStop(_loc5_ + 1);
}
};
_loc4_.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(this.hitTest(bg.santa.g))
{
game_score += Number(this.score);
adjust_score(_root.game_ui);
this.gotoAndStop("score");
play_sound("bonus_sound");
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
this._y -= 2;
if(++this.find_count == 20)
{
this.removeMovieClip();
}
}
};
}
else
{
this.yspeed += 1;
this._y += this.yspeed;
if(this._y > 275)
{
this.gotoAndStop("obox");
create_big_snow(this,2,5,50);
mission_end_count += 50;
var _loc3_ = 0;
while(_loc3_ <= 10)
{
add_presents(this,"presents",random(13) + 1);
_loc3_ = _loc3_ + 1;
}
this.onEnterFrame = function()
{
if(--this._alpha < 5)
{
this.removeMovieClip();
}
};
}
}
}
};
}
}
else
{
add_presents(this,"presents",random(8) + 1);
}
};
who.onEnterFrame = function()
{
if(!_root.game_paused)
{
moveAction(this,this.dir * this.speed,0);
this._rotation += this.dir * 30;
var _loc3_ = false;
if(this.hit_blocks)
{
_loc3_ = true;
}
else if(this._x + this.dir * this.speed < 30)
{
_loc3_ = true;
}
else if(this._x + this.dir * this.speed > 520)
{
_loc3_ = true;
}
if(_loc3_)
{
this.dir *= -1;
if(this._y > stage_down_max)
{
this.hit_count += 3;
}
else
{
this.hit_count = this.hit_count + 1;
}
play_sound("ball_hit");
}
if(this.hit_count >= 5)
{
this.explode();
}
else
{
for(var _loc4_ in bg)
{
if(bg[_loc4_].attack != undefined and bg[_loc4_].living)
{
if(bg[_loc4_]._name != this._name and bg[_loc4_]._name != "santa")
{
if(bg[_loc4_].g.hitTest(this.iceball))
{
bg[_loc4_].monster_dead();
play_sound("ball_crash");
if(bg[_loc4_].typ != "boss")
{
this.kill_count = this.kill_count + 1;
}
else
{
this.explode();
}
break;
}
}
}
}
}
}
};
}
}
function get_map_point(which)
{
if(which != undefined)
{
var _loc1_ = new Object();
_loc1_.x = which._x;
_loc1_.y = which._y;
which._parent.localToGlobal(_loc1_);
var _loc2_ = [];
_loc2_[0] = _loc1_.x;
_loc2_[1] = _loc1_.y;
return _loc2_;
}
}
function bossAI1(who)
{
who.states = "stand";
who.living = true;
who.xspeed = -6;
who.blood = game_boss1_health;
who.attack = true;
who.typ = "boss";
who.turn = function()
{
this.xspeed *= -1;
};
who.get_blocked = function()
{
if(this.living)
{
this.turn();
}
};
who.stand = function()
{
this.gotoAndStop("stand");
this.action_count = 0;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count == 30)
{
if(monsters_exist <= 1)
{
this.summon();
}
else if(!random(2))
{
this.move_me();
}
else
{
this.jump();
}
}
}
};
};
who.jump = function()
{
this.gotoAndStop("jump");
this.cross_step = 25;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
moveAction(this,0,-20);
if(this.states == "stand")
{
create_land_snow(this);
if(!random(2))
{
this.move_me();
}
else
{
this.stand();
}
}
}
};
};
who.move_me = function()
{
this.gotoAndStop("walk");
this.action_count = 0;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
moveAction(this,this.xspeed,0);
if(this._x + this.xspeed > stage_max)
{
this.turn();
}
else if(this._x + this.xspeed < stage_min)
{
this.turn();
}
else if(this.hit_blocks)
{
this.turn();
}
if(this.states == "stand")
{
if(++this.action_count == 150)
{
this.stand();
}
}
}
};
};
who.summon = function()
{
this.gotoAndStop("summon");
this.action_count = 0;
create_monsters(random(3) + 1,90,-100 - random(100));
create_monsters(random(3) + 1,270,-100 - random(100));
create_monsters(random(3) + 1,450,-100 - random(100));
monsters_exist += 3;
monster_all = monsters_exist;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count > 50)
{
if(!random(2))
{
this.move_me();
}
else
{
this.jump();
}
}
}
};
};
who.monster_dead = function()
{
delete this.onEnterFrame;
if(--this.blood > 0)
{
this.action_count = 0;
this.gotoAndStop("hit");
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count > 30)
{
this.move_me();
}
}
};
}
else
{
monsters_exist--;
boss_all_kill();
mission_end_count += 50;
var _loc3_ = 0;
while(_loc3_ <= 10)
{
add_presents(this,"presents",random(13) + 1);
_loc3_ = _loc3_ + 1;
}
this.gotoAndStop("die");
}
_root["game_boss" + game_level + "_health"] = this.blood;
adjust_boss(_root.game_ui);
};
who.stand();
}
function boss_all_kill()
{
play_music("music_win",true);
for(var _loc1_ in bg)
{
if(bg[_loc1_].typ != "boss")
{
if(bg[_loc1_]._name != "santa")
{
if(bg[_loc1_].attack != undefined)
{
if(bg[_loc1_].living)
{
bg[_loc1_].monster_dead();
}
}
}
}
}
}
function bossAI2(who)
{
who.states = "stand";
who.living = true;
who.xspeed = -3;
who.blood = game_boss2_health;
who.attack = true;
who.typ = "boss";
who.turn = function()
{
this.xspeed *= -1;
};
who.get_blocked = function()
{
if(this.living)
{
this.turn();
}
};
who.stand = function()
{
this.gotoAndStop("stand");
this.action_count = 0;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count == 30)
{
if(monsters_exist <= 1)
{
this.summon();
}
else if(!random(2))
{
this.move_me();
}
else
{
this.attacking();
}
}
}
};
};
who.move_me = function()
{
this.gotoAndStop("walk");
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
moveAction(this,this.xspeed,0);
if(this._x + this.xspeed > stage_max - 50)
{
this.turn();
}
else if(this._x + this.xspeed < stage_min + 50)
{
this.turn();
}
else if(this.hit_blocks)
{
this.turn();
}
if(this.states == "stand")
{
if(Math.abs(this._x - bg.santa._x) < 20)
{
this.attacking();
}
else if(!random(250))
{
this.stand();
}
}
}
};
};
who.attacking = function()
{
this.gotoAndStop("attack");
this.action_count = 0;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count > 43)
{
this.stand();
}
}
};
};
who.attackAction = function()
{
var _loc4_ = bg.getNextHighestDepth();
var _loc3_ = bg.attachMovie("iceball","boss2iceball_" + _loc4_,_loc4_);
_loc3_._x = this._x;
_loc3_._y = this._y - 80;
_loc3_.gotoAndStop(4);
_loc3_.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(this.hitTest(bg.santa.g))
{
bg.santa.to_die();
this.gotoAndPlay(7);
delete this.onEnterFrame;
}
this._y += 25;
if(this._y > 500)
{
this.removeMovieClip();
}
}
};
};
who.summon = function()
{
this.gotoAndStop("summon");
this.action_count = 0;
create_monsters(random(5) + 1,34,58);
create_monsters(random(5) + 1,516,58);
create_monsters(random(5) + 1,108,130);
create_monsters(random(5) + 1,443,130);
monsters_exist += 4;
monster_all = monsters_exist;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count > 44)
{
this.stand();
}
}
};
};
who.monster_dead = function()
{
delete this.onEnterFrame;
if(--this.blood > 0)
{
this.action_count = 0;
this.gotoAndStop("hit");
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count > 30)
{
this.move_me();
}
}
};
}
else
{
monsters_exist--;
boss_all_kill();
mission_end_count += 50;
var _loc3_ = 0;
while(_loc3_ <= 10)
{
add_presents(this,"presents",random(13) + 1);
_loc3_ = _loc3_ + 1;
}
this.gotoAndStop("die");
}
_root["game_boss" + game_level + "_health"] = this.blood;
adjust_boss(_root.game_ui);
};
who.stand();
}
function bossAI3(who)
{
who.states = "stand";
who.living = true;
who.blood = game_boss3_health;
who.attack = true;
who.typ = "boss";
who.stand_array = [[275,123],[72,103],[485,103]];
who.stand = function()
{
this.gotoAndStop("stand");
this.action_count = 0;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count == 50)
{
if(monsters_exist <= 1)
{
this.summon();
}
else
{
this.kiss();
}
}
}
};
};
who.kiss = function()
{
this.gotoAndStop("attack");
this.action_count = 0;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(this.g.hitTest(bg.santa.g))
{
bg.santa.to_die();
}
if(++this.action_count > 35)
{
this.move_me();
}
}
};
};
who.move_me = function()
{
this.gotoAndStop("fly");
if(this.attack)
{
this.target_x = bg.santa._x;
this.target_y = bg.santa._y + 15;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
this._x += (this.target_x - this._x) / 20;
this._y += (this.target_y - this._y) / 20;
if(this.g.hitTest(bg.santa.g))
{
bg.santa.to_die();
}
if(Math.abs(this.target_y - this._y) < 5)
{
this.attack = false;
this.move_me();
}
}
};
}
else
{
var _loc3_ = this.stand_array[random(3)];
this.target_x = _loc3_[0];
this.target_y = _loc3_[1];
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
this._x += (this.target_x - this._x) / 20;
this._y += (this.target_y - this._y) / 20;
if(this.g.hitTest(bg.santa.g))
{
bg.santa.to_die();
}
if(Math.abs(this.target_x - this._x) < 5)
{
if(Math.abs(this.target_y - this._y) < 5)
{
this.attack = true;
this.stand();
}
}
}
};
}
};
who.summon = function()
{
this.gotoAndStop("summon");
this.action_count = 0;
create_monsters(random(6) + 1,90,230 + random(120));
create_monsters(random(6) + 1,180,230 + random(120));
create_monsters(random(6) + 1,270,230 + random(120));
create_monsters(random(6) + 1,360,230 + random(120));
create_monsters(random(6) + 1,450,230 + random(120));
monsters_exist += 5;
monster_all = monsters_exist;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count > 50)
{
this.stand();
}
}
};
};
who.monster_dead = function()
{
delete this.onEnterFrame;
if(--this.blood > 0)
{
this.action_count = 0;
this.gotoAndStop("hit");
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count > 30)
{
this.attack = false;
this.move_me();
}
}
};
}
else
{
monsters_exist--;
boss_all_kill();
mission_end_count += 50;
var _loc3_ = 0;
while(_loc3_ <= 10)
{
add_presents(this,"presents",random(13) + 1);
_loc3_ = _loc3_ + 1;
}
this.gotoAndStop("die");
}
_root["game_boss" + game_level + "_health"] = this.blood;
adjust_boss(_root.game_ui);
};
who.stand();
}
function bossAI4(who)
{
who.states = "stand";
who.living = true;
who.blood = game_boss4_health;
who.attack = true;
who.typ = "boss";
who.stand = function()
{
this.gotoAndStop("stand");
this.action_count = 0;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count == 50)
{
if(monsters_exist <= 1)
{
this.summon();
}
else if(!random(2))
{
this.move_me();
}
else
{
this.tracing();
}
}
}
};
};
who.move_me = function()
{
this.gotoAndStop("move");
this.action_count = 0;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
this.action_count = this.action_count + 1;
if(this.action_count == 5)
{
this._alpha = 40;
}
else if(this.action_count == 15)
{
this._alpha = 0;
this._x = random(450) + 50;
this._y = random(200) + 150;
}
else if(this.action_count == 20)
{
this._alpha = 40;
}
else if(this.action_count == 30)
{
this._alpha = 100;
this.stand();
}
}
};
};
who.tracing = function()
{
this.gotoAndStop("trace");
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(this.g.hitTest(bg.santa.g))
{
bg.santa.to_die();
}
this._x += (bg.santa._x - this._x) / 20;
this._y += (bg.santa._y - 120 - this._y) / 20;
if(Math.abs(bg.santa._x - this._x) < 5)
{
this.attacking();
}
}
};
};
who.attacking = function()
{
this.gotoAndStop("attack");
this.action_count = 0;
var _loc4_ = bg.getNextHighestDepth();
this.mother_mc = bg.createEmptyMovieClip("boss4iceball",_loc4_);
this.mother_mc._x = this._x;
this.mother_mc._y = this._y - 100;
this.mother_mc.attachMovie("iceball","iceball_1",1);
this.mother_mc.iceball_1._x = -50;
this.mother_mc.iceball_1.gotoAndStop(5);
this.mother_mc.attachMovie("iceball","iceball_2",2);
this.mother_mc.iceball_2._x = 50;
this.mother_mc.iceball_2.gotoAndStop(5);
var _loc3_ = new Color(this.mother_mc);
_loc3_.setTransform(shine_Transform2);
this.mother_mc._xscale = 10;
this.mother_mc._yscale = 10;
this.mother_mc.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(this._xscale > 100)
{
this._xscale = 100;
var _loc3_ = new Color(this);
_loc3_.setTransform(shine_Transform1);
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(this.hitTest(bg.santa.g))
{
bg.santa.to_die();
this.iceball_1.gotoAndPlay(7);
this.iceball_2.gotoAndPlay(7);
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(this.iceball_1 == undefined)
{
this.removeMovieClip();
}
}
};
}
}
this._y += 10;
if(this._y > 500)
{
this.removeMovieClip();
}
};
}
this._xscale += 10;
this._yscale += 10;
}
};
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
this.action_count = this.action_count + 1;
if(this.action_count > 32)
{
this.stand();
}
}
};
};
who.summon = function()
{
this.gotoAndStop("summon");
this.action_count = 0;
create_monsters(random(8) + 1,60 + random(160),225);
create_monsters(random(8) + 1,340 + random(160),225);
monsters_exist += 2;
monster_all = monsters_exist;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count > 25)
{
this.stand();
}
}
};
};
who.revenge = function()
{
this.gotoAndStop("revenge");
this.action_count = 0;
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count > 81)
{
this.stand();
}
}
};
};
who.revenging = function()
{
if(random(2))
{
var _loc6_ = 110;
var _loc8_ = 0;
var _loc7_ = 5;
}
else
{
_loc6_ = 50;
_loc8_ = 1;
_loc7_ = 10;
}
var _loc5_ = _loc8_;
while(_loc5_ <= _loc7_)
{
var _loc4_ = bg.getNextHighestDepth();
var _loc3_ = bg.attachMovie("monsterboss4_weapon","monsterboss4_weapon" + _loc4_,_loc4_);
_loc3_._x = _loc6_ * _loc5_;
_loc3_._y = -80 - random(150);
_loc3_.gotoAndStop(4);
_loc3_.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(!this.attacked)
{
if(this.hitTest(bg.santa.g))
{
this.attacked = true;
bg.santa.to_die();
}
}
this._y += 15;
if(this._y > 500)
{
this.removeMovieClip();
}
}
};
_loc5_ = _loc5_ + 1;
}
};
who.monster_dead = function()
{
this._alpha = 100;
delete this.onEnterFrame;
if(--this.blood > 0)
{
this.action_count = 0;
this.gotoAndStop("hit");
this.onEnterFrame = function()
{
if(!_root.game_paused)
{
if(++this.action_count > 30)
{
this.revenge();
}
}
};
}
else
{
monsters_exist--;
boss_all_kill();
mission_end_count += 50;
var _loc3_ = 0;
while(_loc3_ <= 30)
{
add_presents(this,"presents",random(13) + 1);
_loc3_ = _loc3_ + 1;
}
this.gotoAndStop("die");
}
_root["game_boss" + game_level + "_health"] = this.blood;
adjust_boss(_root.game_ui);
};
who.stand();
}
function play_music(what, cyc)
{
if(this[what] == undefined)
{
this[what] = new Sound();
this[what].attachSound(what);
}
if(game_music)
{
if(now_music != what or music_resume)
{
now_music = what;
music_resume = false;
stopAllSounds();
if(!cyc)
{
this[what].start();
}
else
{
this[what].start(0,999999);
}
}
}
}
function play_sound(what)
{
if(this[what] == undefined)
{
this[what] = new Sound();
this[what].attachSound(what);
}
if(game_music)
{
this[what].stop(what);
this[what].start();
}
}
stop();
var bb = 6;
_root.wudi.gotoAndStop(2);
var v = 6;
arr = [75,75,74];
arr2 = [75,76,87];
arr3 = [76,87,76,87];
mmm = 0;
this.createEmptyMovieClip("mc1",getNextHighestDepth());
this.createEmptyMovieClip("mc2",getNextHighestDepth());
this.createEmptyMovieClip("mc3",getNextHighestDepth());
var key_func1 = new key_func(arr2,ob1,ob2,mc2,func,300);
var key_func2 = new key_func(arr,ob3,ob4,mc1,func_2,300);
var key_func3 = new key_func(arr3,ob5,ob6,mc3,func_3,300);
Key_obj = {};
Key_obj.num = 0;
Key_obj.onKeyDown = function()
{
this.btn_blo = true;
};
Key_obj.onKeyUp = function()
{
this.btn_blo = false;
};
Key.addListener(Key_obj);
if(game_mask == undefined)
{
_root.attachMovie("game_mask","game_mask",1000);
_root.setMask(game_mask);
}
btns.btn01.onPress = function()
{
play_sound("button_sound");
};
btns.btn01.onRelease = function()
{
next_round();
};
btns.btn02.onPress = function()
{
play_sound("button_sound");
};
btns.btn02.onRelease = function()
{
help.play();
};
play_music("music_op",true);
snow_down(bg);
_root.score = 0;
game_score = 0;
Stage.scaleMode = "noScale";
myMenu = new ContextMenu();
myMenu.hideBuiltInItems();
_root.menu = myMenu;
getURL("FSCommand:trapallkeys",true);
game_paused = true;
game_music = true;
music_resume = false;
game_level = 1;
game_stage = 0;
stage_max = 525;
stage_min = 25;
stage_down_max = 325;
monsters_exist = 0;
monster_all = 0;
game_score = 0;
game_life = 10;
game_power = org_game_power = 1;
game_range = org_game_range = 12;
game_speed = org_game_speed = 4;
game_boss1_health = 5;
game_boss2_health = 8;
game_boss3_health = 8;
game_boss4_health = 10;
game_time = 60;
shine_Transform1 = {ra:100,rb:0,ga:100,gb:0,ba:100,bb:0,aa:100,ab:0};
shine_Transform2 = {ra:0,rb:255,ga:0,gb:255,ba:0,bb:255,aa:100,ab:0};
Acode = org_Acode = 65;
Dcode = org_Dcode = 68;
Wcode = org_Wcode = 87;
Scode = org_Scode = 83;
Jcode = org_Jcode = 85;